#include "app_runner.h"
static int is_running = 1;
static void runner_exit(int sig)
{
    if (sig == SIGINT || sig == SIGTERM)
    {
        is_running = 0;
    }
    
   
}

int app_runner_run()
{
    // 0 注册终止信号 //ctrl+c kill
    signal(SIGTERM, runner_exit); // kill
    signal(SIGINT, runner_exit);  // ctrl+c

    device_t *device = app_device_init(DEVICE_FILE);
    // 4 初始化蓝牙/串口
    app_bt_init(device);
    // 5 启动设备
    app_device_start();

    while (is_running)
    {
        sleep(1);
    }
    // 7 释放资源
    app_device_destroy();

    return 0;
}